<template>
	<view>
		<view class="head">
			<view class="headline" >
				个人中心
			</view>
			<view class="user">
				<view v-show="userInfo.length>0">
					<img class="userPhoto" :src="userInfo[0].userPhoto" alt="">
				</view>
			</view>
			<view class="userName" v-show="userInfo.length>0">
				{{userInfo[0].userName}}
			</view>
			<view class="information" v-show="userInfo.length==0">
				<view class="iconfont icon-touxiang"  ></view>
				<button class="login" @click="login">点此登录</button>
			</view>
			<view class="skip">
				<van-cell title="我的买入" @click="BuyOrders" is-link />
				<van-cell title="我的卖出" @click="SaleOrders" is-link  />
				<van-cell title="我的收藏" @click="MyCollection" is-link  />
				<van-cell title="我的关注" @click="MyInterest" is-link />
				<van-cell title="个人信息" @click="PersonalDetails" is-link  />
				<van-cell title="信息设置" @click="MessageSettings" is-link  />
				<van-cell title="拍卖预约" @click="MySubscribe" is-link />
				<van-cell title="浏览记录" @click="Cookies" is-link  />
				<van-cell title="联系客服" @click="Service" is-link  />
			</view>
			<view >
				<button class="exit" @click="exit">退出登录</button>
			</view>
			
		</view>
		
	</view>
</template>

<script>
import request from '../../com/request.js'
	export default {
		data() {
			return {
				userInfo:''
			}
		},
		methods: {
			login(){
				uni.redirectTo({
					url: '/pages/login/login'
				});
			},
			exit(){
				uni.removeStorageSync('userTel')
				uni.showToast({
					title: '退出成功',
					duration: 2000
				})
				uni.redirectTo({
					url: '/pages/login/login'
				})
			},
			selectUser(){
				request({
					url: 'api/myprofile/get',
					data: {
						acc: uni.getStorageSync("userTel")
					},
					success: (resp) => {
						
						this.userInfo=resp.data.data
						console.log(this.userInfo,62);
					}
				})
			},
			BuyOrders(){
				uni.redirectTo({
					url: '/pages/BuyOrders/BuyOrders'
				});
			},
			SaleOrders(){
				uni.redirectTo({
					url: '/pages/SaleOrders/SaleOrders'
				});
			},
			MyCollection(){
				uni.redirectTo({
					url: '/pages/MyCollection/MyCollection'
				});
			},
			MyInterest(){
				uni.redirectTo({
					url: '/pages/MyInterest/MyInterest'
				});
			},
			PersonalDetails(){
				uni.redirectTo({
					url: '/pages/PersonalDetails/PersonalDetails'
				});
			},
			MySubscribe(){
				uni.redirectTo({
					url: '/pages/MySubscribe/MySubscribe'
				});
			},
			Cookies(){
				uni.redirectTo({
					url: '/pages/Cookies/Cookies'
				});
			},
			MessageSettings(){
				uni.redirectTo({
					url: '/pages/MessageSettings/MessageSettings'
				})
			},
			Service(){
				uni.redirectTo({
					url: '/pages/customerchat/customerchat'
				})
			}
		},
		onLoad(){
			this.selectUser()
		}
	}
</script>

<style>
.head{
	position: absolute;
	width: 100%;
	height: 230px;
	background-color: rgb(246, 237, 108);
}
.headline{
	width: 200rpx;
	font-size: 50rpx;
	/* font-weight:bolder; */
	margin: 30px auto;
}
.icon-touxiang{
	font-size: 60px;
	margin-left: 30rpx;
}
.information{
	display: flex;
	width: 55%;
	height: 100px;
}
.login{
	height: 30px;
	margin-top: 15px;
	line-height: 30px;
}
.skip{
	margin-top:80px ;
}
.exit{
	margin-top:30px ;
	background-color:rgb(246, 237, 108);
	width: 200rpx;
	/* color: gray; */
	font-size: 35rpx;
}
.userPhoto{
	width: 150rpx;
	height: 150rpx;
	border-radius:100% ;
	margin: 0 auto;
}
.user{
	display: flex;
	justify-content: center;
}
.userName{
	text-align: center;
}
</style>
